//---------------------------------------------------------------------
// File: Echo.cs
// 
// Summary: 
//
// Copyright (c) Hammersmith & Fulham Bridge Partnership. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//---------------------------------------------------------------------

using System;
using System.Xml;
using Microsoft.Services.BizTalkApplicationFramework.BizUnit;

namespace BizUnit.Extensions
{
	/// <summary>
	/// This step echoes a given string to the console output. It is extremely useful when
	/// tracing through large test scripts and we need to know at what stage we are at. Its a sort
	/// of Debug.WriteLine functionality. 
	/// </summary>
	/// 
	/// <remarks>
	/// The following shows an example of the Xml representation of this test step.
	/// 
	/// <code escaped="true">
	///	<TestStep assemblyPath="" typeName="BizUnit.Extensions.WaitOnFileStep">
	///		<Path>n:\\</Path>
	///		<FileFilter>*.xml</FileFilter>
	///		<TimeOut>10000</TimeOut>
	///		<IncludeOldFiles>Y</IncludeOldFiles>
	///	</TestStep>
	///	</code>
	///	
	///	<list type="table">
	///		<listheader>
	///			<term>Tag</term>
	///			<description>Description</description>
	///		</listheader>
	///		<item>
	///			<term>Path</term>
	///			<description>The directory to look for the FILE</description>
	///		</item>
	///		<item>
	///			<term>FileFilter</term>
	///			<description>The FILE mask to be used to search for a FILE, e.g. *.xml</description>
	///		</item>
	///		<item>
	///			<term>TimeOut</term>
	///			<description>The time to wait for the FILE to become present in miliseconds</description>
	///		</item>
	///	</list>
	///	</remarks>

	public class EchoStep : ITestStep
	{

		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(XmlNode testConfig, Context context)
		{
			// read test config...
			string echoString = context.ReadConfigAsString( testConfig, "Message" );
			context.LogInfo(String.Format("**** STAGE *** {0}",echoString));
		}

	}
}
